//JavaScript代码区域
layui.use(['element', 'table', 'jquery', 'laydate', 'form'], function () {
    var element = layui.element;
    var table = layui.table;
    var laydate = layui.laydate;
    var form = layui.form;
    $(function () {
        tableRender();
        form.render();
    })

    function tableRender() {
        table.render({
            elem: '#login_record'
            // , height: 312
            ,
            url: LOCALHOSTURL + '/user/log/getUserLogRecords' //数据接口
            ,
            method: "get",
            where: {
                user_code: sessionStorage.getItem("user_code")
            },
            xhrFields: {
                withCredentials: true //默认情况下，标准的跨域请求是不会发送cookie的
            },
            headers: {
                "Authorization": $.cookie("token")
            },
            crossDomain: true,
            response: {
                statusName: 'code' //规定数据状态的字段名称，默认：code
                ,
                statusCode: 200 //规定成功的状态码，默认：0
            },
            page: true,
            title: "签到记录表",
            toolbar: true,
            defaultToolbar: ['filter', 'exports', 'print'],
            cols: [
                [ //表头
                    {
                        field: 'userCode',
                        title: '用户名'
                    },
                    {
                        field: 'ipAddress',
                        title: '登录地址'
                    },
                    {
                        field: 'loginTime',
                        title: '登录时间',
                        sort: true
                    }
                ]
            ],
            done: function (res) {
                console.log(res);
            }
        });
    }


});
